package com.lorry.backend.controller;


import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.MessageSource;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Locale;

@RestController
public class i18nController {

    @Autowired
    private MessageSource messageSource;

    @GetMapping("/hello")
    public String contextLoads() {
        System.out.println(messageSource.getMessage("i18nMessage.languageTag", null, Locale.US));  // Hello
        System.out.println(messageSource.getMessage("lorry.code", null, Locale.CHINA));  // 你好中文
        return null;
    }
}
